package org.rency.mq.activemq.service;

import org.rency.mq.activemq.exception.MQException;
import org.rency.mq.activemq.request.MQRequest;

/**
 * 消息收发服务
 */
public interface MQService {
	/**
	 * 发送消息，默认通过ActionId查询目的地信息
	 * @param request	消息请求对象
	 * @throws MQException
	 */
	public void sendMessage(MQRequest request) throws MQException;
	
	/**
	 * 接收消息
	 * @param queueName	队列名称
	 * @return
	 * @throws MQException
	 */
	public Object receiveMessage(String queueName) throws MQException;
	
	/**
	 * 接收消息
	 * @param actionId      ActionId
	 * @return
	 * @throws MQException
	 */
	public Object receiveMessage(int actionId) throws MQException;

	/**
	 * 接收消息
	 * @param actionId      ActionId
	 * @param selector	消息选择条件
	 * @return
	 * @throws MQException
	 */
	public Object receiveMessage(int actionId, String selector) throws MQException;

	/**
	 * 接收消息
	 * @param actionId              ActionId
	 * @param transacted		是否支持事务
	 * @param acknowledgeMode	应答模式
	 * @param selector		消息选择条件
	 * @return
	 * @throws MQException
	 */
	public Object receiveMessage(int actionId, boolean transacted, int acknowledgeMode, String selector) throws MQException;
}
